﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ChargeMangement.BLL;

namespace CharegeMangement.WebPL
{
    public partial class _Default : System.Web.UI.Page
    {
        double total = 0.0d;//用于总计
        CashFacade cf = new CashFacade();

        protected void Page_Load(object sender, EventArgs e)
        {
            //读数据绑定下拉列表
            cbxType.DataSource = cf.GetCashAcceptTypeList();
            cbxType.SelectedIndex = 0;

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            double totalPrices = 0d;
            //传进下拉选择值和原价，计算实际收费结果
            totalPrices = cf.GetFactTotal(cbxType.SelectedItem.ToString(), Convert.ToDouble(txtPrice.Text) * Convert.ToDouble(txtNum.Text));
            total = total + totalPrices;
            lbxList.Items.Add("单价：" + txtPrice.Text + " 数量：" + txtNum.Text + " " + cbxType.SelectedItem + " 合计：" + totalPrices.ToString());
            lblResult.Text = total.ToString();

        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            total = 0d;
            txtPrice.Text = "0.00";
            txtNum.Text = "0";
            lbxList.Items.Clear();
            lblResult.Text = "0.00";

        }
    }
}
